﻿<!--                                                                              -->
<!-- ____________________________________________________________________________ -->
<!--|                                                                            |-->
<!--|  Copyright (1999-2010) by Actify, Inc.                                     |-->
<!--|                                                                            |-->
<!--|  This program is proprietary with Actify, Inc., and is not to              |-->
<!--|  be reproduced or transmitted in any form or by any means or used in any   |-->
<!--|  manner except as authorized in writing by Actify, Inc.                    |-->
<!--|                                                                            |-->
<!--|____________________________________________________________________________|-->
<!--|                                                                            |-->
<!--|   File Name : MainPage.xaml                                                |-->
<!--|  Written By : Clay Tornquist                                               |-->
<!--|        Date : Feb 09 2010                                                  |-->
<!--| Description :                                                              |-->
<!--|                                                                            |-->
<!--|____________________________________________________________________________|-->
<!--|                                                                            |-->
<!--| Notes:                                                                     |-->
<!--|                                                                            |-->
<!--|____________________________________________________________________________|-->
<!--                                                                              -->
<!-- Changes:                                                                     -->
<!--	[2010-02-09 CMT] - Initial implementation.                                -->
<!--                                                                              -->
<!--                                                                              -->
<UserControl xmlns:my="clr-namespace:Microsoft.Silverlight.Testing.UnitTesting.UI;assembly=Microsoft.Silverlight.Testing"  x:Class="SpinFireSL.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls" 
    xmlns:theming="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.Toolkit"  
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="640">
    <UserControl.Resources>
        <Style TargetType="telerikInput:RadColorPaletteViewItem" x:Key="DefaultItemTemplate">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerikInput:RadColorPaletteViewItem">
                        <Grid>
                            <Grid x:Name="RootElement" Margin="0" Background="Transparent">

                                <Border Height="18" Width="18" BorderBrush="#FFA0A0A0" BorderThickness="1"
                                                Margin="1" x:Name="borderContent" 
                                                VerticalAlignment="Stretch"  >

                                    <Rectangle x:Name="color" Height="16" Width="16" Stroke="#FFFFFFFF"
                                                Stretch="Fill" VerticalAlignment="Center" HorizontalAlignment="Center" 
                                                Fill="{TemplateBinding Content}" MouseLeftButtonDown="color_MouseLeftButtonDown" />
                                </Border>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ExpanderStyle" TargetType="ToggleButton">
            <Setter Property="IsEnabled" Value="True" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Grid x:Name="Button" Margin="0" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                             Width="10" Height="21">
                            <Polygon Stroke="Black" Fill="Transparent" Points="0,0 8,8 0,16" StrokeThickness="1" >
                            </Polygon>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <telerik:HierarchicalDataTemplate x:Key="GeometryTemplate" 
            ItemsSource="{Binding Path=ChildItems}" 
            ItemTemplate="">
            <StackPanel Orientation ="Horizontal" VerticalAlignment="Top">
                <Grid Width="16" Height="16"  MouseLeftButtonDown="ModelShow_Button_Click" >
                    <Ellipse Fill="{Binding Path=EntityColor}" Stroke="#FF535353" HorizontalAlignment="Left" VerticalAlignment="Top" Height="14" Width="14" />
                    <Line x:Name="line1" X1="2" Y1="2" X2="12" Y2="12" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="{Binding Path=HiddenLineColor}"/>
                    <Line x:Name="line2" X1="2" Y1="12" X2="12" Y2="2" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="{Binding Path=HiddenLineColor}"/>
                </Grid>
                <Image Margin="6,0,0,0" MouseLeftButtonDown="ModelZoom_Button_Click" HorizontalAlignment="Left" VerticalAlignment="Top" Height="15" Width="15" Source="Images/cube grey 256x256.png" />
                <TextBlock FontStyle="Italic" FontWeight="Normal" Text="{Binding Path=Title}" Margin="6,0,0,0" VerticalAlignment="Center" Height="16" HorizontalAlignment="Left" />
            </StackPanel>
        </telerik:HierarchicalDataTemplate>
        <telerik:HierarchicalDataTemplate x:Key="MarkupNameTemplate" 
            ItemsSource="{Binding Path=ChildItems}" 
            ItemTemplate="">
            <StackPanel Orientation ="Horizontal" VerticalAlignment="Top">
                <Image MouseLeftButtonDown="MarkupShow_Button_Click" Height="15" Width="15" Source="{Binding Path=ShowHideImage}" />
                <TextBlock FontStyle="Italic" FontWeight="Normal" Text="{Binding Path=Title}" Margin="6,0,0,0" VerticalAlignment="Center"/>
            </StackPanel>
        </telerik:HierarchicalDataTemplate>
        <telerik:HierarchicalDataTemplate x:Key="ViewNameTemplate" 
            ItemsSource="{Binding Path=ChildItems}" 
            ItemTemplate="">
            <StackPanel Orientation ="Horizontal" VerticalAlignment="Top">
                <Image MouseLeftButtonDown="View_GoTo_Button_Click" Height="15" Width="15" Source="Images/Goto View.png" />
                <TextBlock FontStyle="Italic" FontWeight="Normal" Text="{Binding Path=Title}" Margin="6,0,0,0" VerticalAlignment="Center"/>
            </StackPanel>
        </telerik:HierarchicalDataTemplate>
        <telerik:HierarchicalDataTemplate x:Key="RootTemplate" 
            ItemsSource="{Binding Path=ChildItems}" 
            ItemTemplate="">
            <TextBlock FontWeight="Bold" Text="{Binding Path=Title}" Margin="3,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
        </telerik:HierarchicalDataTemplate>
        <Storyboard x:Name="spinStoryBoard">
            <DoubleAnimation RepeatBehavior="Forever"
                             Storyboard.TargetProperty="RotationY" From="0" To="360" Duration="0:0:3">
            </DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="spinTree">
            <DoubleAnimation x:Name="SlideAway" Storyboard.TargetProperty="GlobalOffsetX" From="0" To="200" Duration="0:0:0.5" Completed="DoubleAnimation_Completed">
            </DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="spinTreeBack">
            <DoubleAnimation  x:Name="SlideBack" Storyboard.TargetProperty="GlobalOffsetX" From="200" To="0" Duration="0:0:0.5" Completed="DoubleAnimationBack_Completed">
            </DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="BreadCrumbAdd">
            <ColorAnimation Storyboard.TargetProperty="(Foreground).(Color)" From="OrangeRed" To="Black" Duration="0:0:2.0" Completed="ColorAnimation_Completed">
            </ColorAnimation>
        </Storyboard>
        <ImageBrush x:Key="MenuSperatorBrush" ImageSource="Images/Right open 16x16.png"/>
    </UserControl.Resources>
    <toolkit:DockPanel x:Name="ThePanel" LastChildFill="True" Background="#FF535353" Margin="0" MouseLeftButtonDown="ThePanel_MouseRightButtonDown">
        <telerikRibbonBar:RadRibbonBar toolkit:DockPanel.Dock ="Top" Title="Actify" ApplicationName="SpinFire SL" ApplicationButtonVisibility="Collapsed" TitleBarVisibility="Collapsed" IsMinimized="False" BorderBrush="#FF535353" Margin="0,0,0,0" BorderThickness="0" >
            <telerikRibbonBar:RadRibbonTab Header="View">
                <telerikRibbonBar:RadRibbonGroup Header="Zoom" DialogLauncherVisibility="Collapsed" >
                    <telerikRibbonBar:RadRibbonButton Text="Window" LargeImage="Images/zoom Window.png" Size="Large" 
                            Click="Zoom_Win_Button_Click" >
                        <Button.Projection>
                            <PlaneProjection x:Name="projectionZoomWin"></PlaneProjection>
                        </Button.Projection>
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton Text="All" LargeImage="Images/fit all 2.png" Size="Large" 
                                Click="FitAll_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="FocusOnPointButton" Text="Point" LargeImage="Images/zoom point 256x256.png" Size="Large" 
                                Click="Focus_On_Point_Click" >
                        <Button.Projection>
                            <PlaneProjection x:Name="projectionFocusOnPoint"></PlaneProjection>
                        </Button.Projection>
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton Text="Part" LargeImage="Images/zoom part 256x256.png" Size="Large" 
                                Click="Focus_On_Part_Click" >
                        <Button.Projection>
                            <PlaneProjection x:Name="projectionFocusOnPart"></PlaneProjection>
                        </Button.Projection>
                    </telerikRibbonBar:RadRibbonButton>
                 </telerikRibbonBar:RadRibbonGroup>
                 <telerikRibbonBar:RadRibbonGroup Header="Mouse">
                    <telerikRibbonBar:RadRibbonButton x:Name="PanButton" Text="Pan" LargeImage="Images/Pan unpushed red.png" Size="Large" 
                            Click="Pan_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="RotateButton" Text="Rotate" LargeImage="Images/Rotate pushed.png" Size="Large" 
                            Click="Rotate_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="ZoomButton" Text="Zoom" LargeImage="Images/Zoom Unpushed red.png" Size="Large" 
                            Click="Zoom_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                </telerikRibbonBar:RadRibbonGroup>
            </telerikRibbonBar:RadRibbonTab>
            <telerikRibbonBar:RadRibbonTab Header="Display">
                <telerikRibbonBar:RadRibbonGroup Header="Display">
                    <telerikRibbonBar:RadRibbonButton  x:Name="ShowHideTree" Text="Navigator Off"  LargeImage="Images/tree 256x256.png" Size="Large" 
                            Click="Tree_Window_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton  x:Name="ShowCoordSystems" Text="Show CS" LargeImage="Images/CS 256x256.png" Size="Large" 
                            Click="CS_Display_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton  x:Name="PerspectiveIsometric" Text="Isometric" LargeImage="Images/iso 256x256.png" Size="Large" 
                            Click="PerspectiveIsometric_Display_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadOrderedWrapPanel HorizontalAlignment="Center" >
                        <telerikInput:RadColorPaletteView x:Name="customPaletteView" 
                            ItemContainerStyle="{StaticResource DefaultItemTemplate}" BorderThickness="0" Background="Transparent" Padding="0" />
                        <TextBlock Text="Background" HorizontalAlignment="Center" />
                    </telerikRibbonBar:RadOrderedWrapPanel>
                </telerikRibbonBar:RadRibbonGroup>
            </telerikRibbonBar:RadRibbonTab>
            <telerikRibbonBar:RadRibbonTab Header="Render">
                <telerikRibbonBar:RadRibbonGroup Header="Render">
                    <telerikRibbonBar:RadRibbonButton x:Name="ShadedSmoothButton" Text="Shaded" LargeImage="Images/smooth 256x256.png" Size="Large" 
                            Click="Shaded_Smooth_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="ShadedSmothWithEdgesButton" Text="Shaded Edges" LargeImage="Images/smooth edges 256x256.png" Size="Large" 
                            Click="Shaded_Smoth_With_Edges_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="WireframeAllButton" Text="Wireframe" LargeImage="Images/wire visible 256x256.png" Size="Large" 
                            Click="WireframeAll_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton x:Name="WireframeHLRButton" Text="Wireframe HLR" LargeImage="Images/wire hidden 256x256.png" Size="Large" 
                            Click="WireframeHLR_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                </telerikRibbonBar:RadRibbonGroup>
            </telerikRibbonBar:RadRibbonTab>
            <telerikRibbonBar:RadRibbonTab Header="Markup">
                <telerikRibbonBar:RadRibbonGroup Header="New">
                    <telerikRibbonBar:RadRibbonButton Text="Dimension Marker" LargeImage="Images/Measure button.png" Size="Large" 
                                Click="Distance_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton Text="Notes Marker" LargeImage="Images/Note button.png" Size="Large" 
                                    Click="Note_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton Text="Bounding Box" LargeImage="Images/bounding box button.png" Size="Large" 
                                    Click="Bounding_Box_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                    <telerikRibbonBar:RadRibbonButton Text="Mass" LargeImage="Images/mass properties.png" Size="Large" 
                                    Click="Mass_Properties_Button_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                </telerikRibbonBar:RadRibbonGroup>
                <telerikRibbonBar:RadRibbonGroup Header="Store" >
                    <telerikRibbonBar:RadRibbonButton Text="Save" LargeImage="Images/save markup.png" Size="Large"
                            Click="SaveMarkup_Click" >
                    </telerikRibbonBar:RadRibbonButton>
                </telerikRibbonBar:RadRibbonGroup>
            </telerikRibbonBar:RadRibbonTab>
        </telerikRibbonBar:RadRibbonBar>
        <Border toolkit:DockPanel.Dock="Top" Height="30" Margin="0,-2,0,1" Background="#FF535353" CornerRadius="3" >
            <telerikNavigation:RadMenu ClickToOpen="True" Orientation="Horizontal" Background="#CED3D8" x:Name="BreadCrumb">
                <telerikNavigation:RadMenuItem Header="" x:Name="PartName" Click="PartName_Click"/>
            </telerikNavigation:RadMenu>
        </Border>
        <Grid Background="#DCDCDC">
            <Grid.ColumnDefinitions >
                <ColumnDefinition x:Name="Column1" ></ColumnDefinition>
                <ColumnDefinition x:Name="Splitter" Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="3*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0" VerticalAlignment="Stretch">
                <Canvas x:Name="TreeCanvas" SizeChanged="Canvas_SizeChanged" >                    
                    <!-- The treeview of model information -->
                    <telerikNavigation:RadTreeView SelectionChanged="myTreeView_SelectionChanged"
                        x:Name="myTreeView1" Background="#E3E6E9"
                        Margin="0,3,0,0"
                        BorderBrush="#FF535353"
                        BorderThickness="0,0,0,0"
                        Canvas.ZIndex="0"
                        ItemsSource="{Binding}"
                        ItemTemplate="{StaticResource RootTemplate}" 
                        ExpanderStyle="{StaticResource ExpanderStyle}" SelectionMode="Multiple" 
                        Expanded="myTreeView_Expanded">
                        <telerikNavigation:RadTreeView.Projection>
                            <PlaneProjection x:Name="projectionMyTreeView1"></PlaneProjection>
                        </telerikNavigation:RadTreeView.Projection>
                    </telerikNavigation:RadTreeView>
                    <telerikNavigation:RadTreeView SelectionChanged="myTreeView_SelectionChanged"
                        x:Name="myTreeView2" Background="#E3E6E9"
                        Margin="0,3,0,0"
                        BorderBrush="#FF535353"
                        BorderThickness="0,0,0,0"
                        Canvas.ZIndex="-1"
                        ItemsSource="{Binding}"
                        ItemTemplate="{StaticResource RootTemplate}" 
                        ExpanderStyle="{StaticResource ExpanderStyle}" SelectionMode="Multiple" 
                        Expanded="myTreeView_Expanded">
                        <telerikNavigation:RadTreeView.Projection>
                            <PlaneProjection x:Name="projectionMyTreeView2"></PlaneProjection>
                        </telerikNavigation:RadTreeView.Projection>
                    </telerikNavigation:RadTreeView>
                </Canvas>
            </Grid>
            <!-- vertical spliter -->
            <controls:GridSplitter Grid.Column="1" Background="#E3E6E9" Width="3" HorizontalAlignment="Center" VerticalAlignment="Stretch">
            </controls:GridSplitter>
            <Grid Grid.Column="2">
                <!-- A button the Actify control lives ontop of, when the button resizes so does the control  -->
                <Button Margin="3" BorderBrush="#E3E6E9" Content="Bottom Right" x:Name="ViewerButton" Opacity="0" SizeChanged="Viewer_SizeChanged"></Button>
            </Grid>
        </Grid>
    </toolkit:DockPanel>
</UserControl>
